#include "fyp/render/Factory.h"

//------------------------------------------------------------------------------
// additional header includes
#include <cstdlib>
#include "fyp/render/RendererImpl.h"
#include "fyp/render/ResourceFactory.h"
#include "fyp/render/XMesh.h"
#include "fyp/render/ShaderImpl.h"
#include "fyp/render/TextureImpl.h"
#include "fyp/render/RenderedTextureImpl.h"

//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
namespace render
{
	//--------------------------------------------------------------------------
	IRenderer* CreateRenderer(
		IDirect3DDevice9 *device)
	{
		return new TRendererImpl(device);
	}

	//--------------------------------------------------------------------------
	TResourceFactory* CreateResFactory(
		IDirect3DDevice9 *device)
	{
		return new TResourceFactory(device);
	}

	//--------------------------------------------------------------------------
	IRenderable* CreateXMesh(
		const char* filename,
		TResourceFactory *resFactory)
	{
		return new TXMesh(filename, resFactory);
	}

	//--------------------------------------------------------------------------
	IShader* CreateShader(
		const char* filename,
		const char *technique,
		TResourceFactory *resFactory)
	{
		return new TShaderImpl(filename, technique, resFactory);
	}

	//--------------------------------------------------------------------------
	ITexture* CreateTexture(
		const char* filename,
		TResourceFactory *resFactory)
	{
		return new TTextureImpl(filename, resFactory);
	}

	//--------------------------------------------------------------------------
	IRenderedTexture* CreateRenderedTexture(
		size_t format,
		size_t w,
		size_t h,
		bool hasDepth,
		TResourceFactory *resFactory)
	{
		return new TRenderedTextureImpl( (IRenderedTexture::FORMAT)format, w, h, hasDepth, resFactory );
	}

	//--------------------------------------------------------------------------
}
}
}
